package com.faithbj.printer.service.Impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import com.faithbj.printer.service.extractPrintContentService;

public class extractPrintContentServiceImpl implements
		extractPrintContentService {

	@Override
	public Map<String, String> getPrintContent(WebDriver driver) {
		List<WebElement> eleList = driver.findElements(By.xpath("//span[@id]|//td[@id]"));
		Map<String,String> contentMap = new HashMap<String,String>();
		for(WebElement ele : eleList){
			contentMap.put(ele.getAttribute("id"), ele.getText().trim().replaceAll("&nbsp;",""));
		}
		return contentMap;
	}

}
